package com.zjs.controller;

import com.zjs.pojo.Seller;
import com.zjs.pojo.User;
import com.zjs.serice.SellerService;
import com.zjs.serice.UserService;
import com.zjs.util.ResultStatus;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import vo.AddUserVo;
import vo.UpdatePassword;

@RestController
@Slf4j
@Api(description = "管理员API接口")
public class AdminController {

    @Autowired
    SellerService sellerService;

    /**
     * 登录
     * @param
     * @return
     */
    @ApiOperation(value="PC用户登录", notes="根据用户名和密码进行登录", produces="application/json")
    @PostMapping(value = "loginseller")
    public ResultStatus loginseller (@RequestBody Seller seller) {
        return sellerService.login(seller);
    }

    /**
     * 修改密码
     * @param
     * @return
     */
    @ApiOperation(value="PC修改密码", notes="根据用户名和密码进行修改", produces="application/json")
    @PostMapping(value = "updetesellerpassword")
    public ResultStatus updetesellerpassword (@RequestBody UpdatePassword updatepassword) {
        return sellerService.updetepassword(updatepassword);
    }


    @ApiOperation(value="买家用户注册", notes="买家用户进行注册", produces="application/json")
    @PostMapping(value = "/addseller")
    public ResultStatus addseller(@RequestBody AddUserVo addUserVo) {
        return sellerService.addUser(addUserVo);
    }



}
